home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / doom / server_1.zip / _LIGHTNG.QC < prev    next >
Text File  |  1996-10-04  |  2KB  |  78 lines

  1. /*
  2. **
  3. ** _lightng.qc (Lightning Code , 1.1)
  4. **
  5. ** Copyright (C) 1996 Johannes Plass
  6. ** 
  7. ** This program is free software; you can redistribute it and/or modify
  8. ** it under the terms of the GNU General Public License as published by
  9. ** the Free Software Foundation; either version 2 of the License, or
  10. ** (at your option) any later version.
  11. ** 
  12. ** This program is distributed in the hope that it will be useful,
  13. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ** GNU General Public License for more details.
  16. **
  17. ** You should have received a copy of the GNU General Public License
  18. ** along with this program; if not, write to the Free Software
  19. ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. ** 
  21. ** Author:   Johannes Plass (plass@dipmza.physik.uni-mainz.de)
  22. **
  23. */
  24.  
  25. void(entity player) LightningInit =
  26. {
  27.    if (!USE_MODULE_LIGHTNING) return;
  28.    // nothing to be done here.
  29. };
  30.  
  31. void(entity player) LightningInfo =
  32. {
  33.  
  34.    if (!USE_MODULE_LIGHTNING) return;
  35.  
  36.                // 123456789#123456789#123456789#12345678
  37.    sprint(player,"£");
  38.    sprint(player," Lightning");
  39.    sprint(player,           " reduces the effect of\n");
  40.    sprint(player,"  underwater discharges.\n");
  41. };
  42.  
  43. void(entity player) LightningActiveMessage =
  44. {
  45.    if (!USE_MODULE_LIGHTNING) return;
  46.                // 123456789#123456789#123456789#12345678
  47.    sprint(player,"  Lightning\n");
  48. };
  49.  
  50. void(entity player,vector target_pos) LightningMakeNoise =
  51. {
  52.    local float ddd, sss;
  53.    if (player.lightning_sound_lasttime < 0) sss = 1;
  54.    else if (player.lightning_sound_nexttime < time) sss = 1;
  55.    if (time >= player.lightning_sound_lasttime + 0.1) {
  56.       ddd = vlen(target_pos - player.lightning_target);
  57.       if (ddd > 10) {
  58.          if (random() > 0.3) sss = 2;
  59.       }
  60.    }
  61.    if (sss) {
  62.       if (sss == 2) {
  63.          sound (player, CHAN_WEAPON, "weapons/lstart.wav", 1, ATTN_NORM);
  64.          player.lightning_sound_nexttime = time + 0.6;
  65.       }
  66.       else if (sss == 1) {
  67.          sound (player, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
  68.          player.lightning_sound_nexttime = time + 0.6;
  69.       }
  70.       player.lightning_sound_lasttime = time;
  71.       player.lightning_target = target_pos;
  72.    }
  73. };
  74.  
  75.  
  76.  
  77.  
  78.